<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <script type="text/javascript">
        function register(){
            var id = document.getElementById("id").value;
            var name = document.getElementById("name").value;
            var password = document.getElementById("password").value;
            var confirmpwd = document.getElementById("confirmpwd").value;

            if(password == confirmpwd){
                //两次密码输入相同，可跳转
                var error = document.getElementById("error");
                error.innerHTML="";

            }else{
                //密码输入不同
                var error = document.getElementById("error");
                error.innerHTML="密码输入不一致";
                return false;
            }
        }
    </script>
</head>
<body>
<form action="/register" method="post">
    账号: <input id="id" type="text" name="id"><br>
    昵称: <input id="name" type="text" name="name"><br>
    密码: <input id="password" type="password" name="password"><br>
    确认密码：<input id="confirmpwd" type="password" name="password"><div id="error"></div><br>
    <input th:type="submit" onclick="register()" th:value="注册"/>
</form>
</body>
</html>